package auxx;

import javax.swing.Box;
import javax.swing.JComponent;

/**
 * Graphical User Interface techniques
 * @author Yan Couto
 * @version 1.0
 */
public class GUIPro {
    private GUIPro () {}
    
    /**
     * Centers the second JComponent into the first, horizontally.
     * @param toAdd JComponent that will add the other one
     * @param toBeAdded JComponent to be centered
     * @since 1.0
     */
    public static void HCenter (JComponent toAdd, JComponent toBeAdded) {
        Box b = Box.createHorizontalBox();
        b.add(Box.createHorizontalGlue());
        b.add(toBeAdded);
        b.add(Box.createHorizontalGlue());
        toAdd.add(b);
    }
    /**
     * Centers the second JComponent into the first, vertically.
     * @param toAdd JComponent that will add the other one
     * @param toBeAdded JComponent to be centered
     * @since 1.0
     */
    public static void VCenter (JComponent toAdd, JComponent toBeAdded) {
        Box b = Box.createVerticalBox();
        b.add(Box.createVerticalGlue());
        b.add(toBeAdded);
        b.add(Box.createVerticalGlue());
        toAdd.add(b);
    }
}
